package com.yunkaweilai.android.view.dialog.shop;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.flyco.dialog.utils.CornerUtils;
import com.flyco.dialog.widget.base.BaseDialog;
import com.yunkaweilai.android.R;
import com.yunkaweilai.android.activity.operation.integral.AddIntegralActivity;
import com.yunkaweilai.android.activity.operation.integral.UpdateIntegralActivity;
import com.yunkaweilai.android.activity.shop.AddPtShopActivity;
import com.yunkaweilai.android.activity.shop.AddTimeShopActivity;
import com.yunkaweilai.android.activity.shop.UpdatePtShopActivity2;
import com.yunkaweilai.android.activity.shop.UpdateTimeShopActivity2;

/**
 * 删除图片
 * Created by Administrator on 2017/6/27.
 */

public class ShopInfoImageDelDialog extends BaseDialog<ShopInfoImageDelDialog> {

    public static final String ADDPTSHOP = "ADDPTSHOP";
    public static final String ADDTIMESHOP = "ADDTIMESHOP";
    public static final String UPDATETIMESHOP = "UPDATETIMESHOP";
    public static final String UPDATEPTSHOP = "UPDATEPTSHOP";
    public static final String ADDINTERGRALSHOP = "ADDINTERGRALSHOP";
    public static final String UPDATEINTERGRALSHOP = "UPDATEINTERGRALSHOP";
    TextView idTvDel;
    TextView idTvClose;
    private Context context;
    private ImageView idImgClose;
    private String type;
    private TextView idEdtTypeName;

    public ShopInfoImageDelDialog(Context context,String type) {
        super(context);
        this.context = context;
        this.type = type;

    }

    @Override
    public View onCreateView() {
        widthScale(0);
        //showAnim(new Swing());
        //dismissAnim(this, new ZoomOutExit());
        View inflate = View.inflate(mContext, R.layout.dialog_del_confirm, null);
        idTvDel = (TextView) inflate.findViewById(R.id.id_tv_del);
        idTvClose = (TextView) inflate.findViewById(R.id.id_tv_close);
        idImgClose = ((ImageView) inflate.findViewById(R.id.id_img_close));
        idEdtTypeName = ((TextView) inflate.findViewById(R.id.id_edt_type_name));
        idEdtTypeName.setText("请确认删除图片？");
        //设置背景颜色，和背景的透明圆弧角度
        inflate.setBackgroundDrawable(
                CornerUtils.cornerDrawable(Color.parseColor("#f8f9fa"), dp2px(10)));

        return inflate;
    }

    @Override
    public void setUiBeforShow() {
        idTvDel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (type){
                    case ADDPTSHOP:
                        ((AddPtShopActivity)context).setImages();
                        break;
                    case ADDTIMESHOP:
                        ((AddTimeShopActivity)context).setImages();
                        break;
                    case UPDATETIMESHOP:
                        ((UpdateTimeShopActivity2)context).setImages();
                        break;
                    case UPDATEPTSHOP:
                        ((UpdatePtShopActivity2)context).setImages();
                        break;
                    case ADDINTERGRALSHOP:
                        ((AddIntegralActivity) context).setImages();
                        break;
                    case UPDATEINTERGRALSHOP:
                        ((UpdateIntegralActivity) context).setImages();
                        break;
                }
                dismiss();
            }
        });
        idImgClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                dismiss();
            }
        });
        idTvClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

}